package com.shou.domain.park.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shou.domain.common.DataAnalysisEntity;
import com.shou.domain.common.IBaseService;
import com.shou.domain.common.PageQueryEntity;
import com.shou.domain.park.model.ParkingRecordEntity;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
* @author Nemo
* @description 针对表【parkingrecords(停车记录表，记录车辆的进出信息)】的数据库操作Service
* @createDate 2025-02-07 22:10:51
*/
public interface IParkingRecordService extends IBaseService {
    /**
     * 增加停车记录
     */
    void insertParkingRecord(ParkingRecordEntity parkingRecord);

    /**
     * 根据ID查询停车记录
     */
    ParkingRecordEntity getParkingRecordById(Integer id);

    /**
     * 分页查询停车记录
     */
    IPage<ParkingRecordEntity> pageQuery(PageQueryEntity pageQueryEntity);

    /**
     * 更新停车记录
     */
    void updateParkingRecordById(ParkingRecordEntity parkingRecordEntity);

    /**
     * 根据lotCode和xAxisData查询单位时间段内入场记录数
     */
    List<Long> getInCountsByCodeAndStartTime(String lotCode, List<String> xAxisData, String timeUnit);

    /**
     * 根据lotCode和xAxisData查询单位时间段出场记录数
     */
    List<Long> getOutCountsByCodeAndStartTime(String lotCode, List<String> xAxisData, String timeUnit);

    /**
     * 根据lotCode和startTime查询startime或endtime在单位时间段内的停车记录总数
     */
    List<Double> getOccupancyRatesByCodeAndStartAndEndTime(String lotCode, List<String> xAxisData, String timeUnit, Long totalSpaces);

    /**
     * 根据lotCode计算startTime和endtime时间段内的总收入
     */
    BigDecimal getTotalIncomeByCodeAndStartTime(String lotCode, LocalDateTime startTime, LocalDateTime endTime);
}
